Skip to content

fix(types): Add missing fields to request and response types#3217

Open
mpint wants to merge 15 commits intoXRPLF:mainfrom
mpint:mpint/missing-fields
Open

fix(types): Add missing fields to request and response types#3217
mpint wants to merge 15 commits intoXRPLF:mainfrom
mpint:mpint/missing-fields

Conversation

@mpint
Copy link
Contributor

@mpint mpint commented Feb 27, 2026

High Level Overview of Change

This PR adds missing fields to various request and response types to improve type completeness and accuracy:

  • VaultInfoResponse: Add ledger_current_index field
  • NFTSellOffersRequest/Response: Add limit and marker fields for pagination
  • NFTBuyOffersRequest/Response: Add limit and marker fields for pagination
  • AMMInfoRequest: Add account field
  • AccountNFTsResponse: Add ledger_hash, ledger_index, and validated fields
  • AccountLinesRequest: Add ignore_default field
  • AccountLinesResponse: Add limit field

Context of Change

These fields are documented in the official XRP Ledger API documentation but were missing from the TypeScript type definitions. This discrepancy could lead to:

  • Type errors when developers try to use these documented fields
  • Incomplete IntelliSense/autocomplete support in IDEs
  • Runtime issues where valid API responses don't match the expected types

The fields were likely missing from the original type definitions when they were created, and this PR brings the types into alignment with the actual API specification.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)
  • Documentation Updates
  • Release

Did you update HISTORY.md?

  • Yes
  • No, this change does not impact library users

Test Plan

Tests Added

  • Added integration tests for AccountLinesRequest to verify the ignore_default field works correctly
  • Added integration tests for AMMInfoRequest to verify the account field works correctly
  • Updated existing VaultInfoResponse integration tests to verify the ledger_current_index field

How to Reproduce/Test

  1. Run the integration test suite: npm run test:integration
  2. Verify that the new fields are properly typed and accepted by the API
  3. Check that TypeScript compilation succeeds with no type errors
  4. Verify that the types match the official XRP Ledger API documentation:

Test Results

All integration tests pass successfully, confirming that:

  • The new fields are accepted by the actual XRP Ledger API
  • Type definitions correctly reflect the API behavior
  • No breaking changes to existing functionality

Pull Request opened by Augment Code with guidance from the PR author

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 27, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c08bb25e-e903-445a-9952-44775c23e78e

📥 Commits

Reviewing files that changed from the base of the PR and between 32f7bec and 6dd0338.

📒 Files selected for processing (2)
  • packages/xrpl/test/integration/requests/accountLines.test.ts
  • packages/xrpl/test/integration/requests/accountNFTs.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/xrpl/test/integration/requests/accountLines.test.ts
  • packages/xrpl/test/integration/requests/accountNFTs.test.ts

Walkthrough

This PR expands optional fields across multiple XRPL model interfaces (AccountLines, AccountNFTs, AMMInfo, NFT operations, and VaultInfo) to support pagination and filtering capabilities, and adds comprehensive integration tests validating the new fields and response structures.

Changes

Cohort / File(s) Summary
Request and Response Model Updates
packages/xrpl/src/models/methods/accountLines.ts, packages/xrpl/src/models/methods/accountNFTs.ts, packages/xrpl/src/models/methods/ammInfo.ts, packages/xrpl/src/models/methods/nftBuyOffers.ts, packages/xrpl/src/models/methods/nftSellOffers.ts, packages/xrpl/src/models/methods/vaultInfo.ts
Added optional fields for pagination (limit, marker), filtering (ignore_default, account), and response metadata (ledger_hash, ledger_index, ledger_current_index); made previously required fields optional in AccountNFTs response (ledger_current_index, validated).
Integration Test Coverage
packages/xrpl/test/integration/requests/accountLines.test.ts, packages/xrpl/test/integration/requests/accountNFTs.test.ts, packages/xrpl/test/integration/requests/ammInfo.test.ts, packages/xrpl/test/integration/requests/nftBuyOffers.test.ts, packages/xrpl/test/integration/requests/nftSellOffers.test.ts, packages/xrpl/test/integration/requests/vaultInfo.test.ts
Added new test cases and test files validating pagination fields, optional response fields, ledger metadata, filtering parameters, and marker-based pagination workflows.
Test Infrastructure
packages/xrpl/test/testUtils.ts
Refactored socket cleanup logic to cache socketMap entry, improving code readability without altering functional behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • ckeshava
  • achowdhry-ripple
  • Patel-Raj11

Poem

🐰 Hopping through the ledger with glee,
New fields bloom like clover—can't you see?
Pagination bounces, limits align,
Tests verify each hop is divine!
XRPL's garden grows day by day. 🌱✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding missing fields to TypeScript request and response types to align with XRP Ledger API documentation.
Description check ✅ Passed The description comprehensively covers all required template sections: high-level overview of changes, context explaining why fields were missing, type of change selection (new feature and tests), test plan with specific test additions, and HISTORY.md decision.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ckeshava
Copy link
Collaborator

ckeshava commented Mar 2, 2026

@mpint can you fix the linter errors in the CI?

Copy link
Collaborator

@ckeshava ckeshava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add integration tests that exercise the newly added fields of the request/response methods.

*/
marker?: unknown
/**
* The limit value used in the request.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is not true. Please use the text from the xrpl.org website verbatim:

The maximum number of trust lines retrieved. The server may return fewer than the specified limit, even if more results are available. If no limit was specified in the request, use a default limit of 200.

asset2?: Currency

/**
* The address of another account which holds LP Tokens for the requested AMM.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is not correct. The documentation text reads:

Show only LP Tokens held by this liquidity provider.

@ckeshava
Copy link
Collaborator

ckeshava commented Mar 2, 2026

@mpint You can fix the linter errors by applying this patch:

diff --git a/packages/xrpl/src/models/methods/accountLines.ts b/packages/xrpl/src/models/methods/accountLines.ts
index b74fc18b4..c613cb549 100644
--- a/packages/xrpl/src/models/methods/accountLines.ts
+++ b/packages/xrpl/src/models/methods/accountLines.ts
@@ -73,8 +73,7 @@ export interface AccountLinesTrustline {
  * @category Requests
  */
 export interface AccountLinesRequest
-  extends BaseRequest,
-    LookupByLedgerRequest {
+  extends BaseRequest, LookupByLedgerRequest {
   command: 'account_lines'
   /** A unique identifier for the account, most commonly the account's Address. */
   account: string
diff --git a/packages/xrpl/src/models/methods/nftBuyOffers.ts b/packages/xrpl/src/models/methods/nftBuyOffers.ts
index f9d297520..7b03be2c3 100644
--- a/packages/xrpl/src/models/methods/nftBuyOffers.ts
+++ b/packages/xrpl/src/models/methods/nftBuyOffers.ts
@@ -9,8 +9,7 @@ import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
  * @category Requests
  */
 export interface NFTBuyOffersRequest
-  extends BaseRequest,
-    LookupByLedgerRequest {
+  extends BaseRequest, LookupByLedgerRequest {
   command: 'nft_buy_offers'
   /**
    * The unique identifier of an NFToken. The request returns buy offers for this NFToken.
diff --git a/packages/xrpl/src/models/methods/nftSellOffers.ts b/packages/xrpl/src/models/methods/nftSellOffers.ts
index b56df1091..c52e57d96 100644
--- a/packages/xrpl/src/models/methods/nftSellOffers.ts
+++ b/packages/xrpl/src/models/methods/nftSellOffers.ts
@@ -9,8 +9,7 @@ import { BaseRequest, BaseResponse, LookupByLedgerRequest } from './baseMethod'
  * @category Requests
  */
 export interface NFTSellOffersRequest
-  extends BaseRequest,
-    LookupByLedgerRequest {
+  extends BaseRequest, LookupByLedgerRequest {
   command: 'nft_sell_offers'
   /**
    * The unique identifier of an NFToken. The request returns sell offers for this NFToken.

@@ -132,5 +138,9 @@ export interface AccountLinesResponse extends BaseResponse {
* No additional pages after this one.
*/
marker?: unknown
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there should be another base type for marker/limit (like LookupByLedgerRequest)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea being easier type composability (e.g. type C = A & B)?

Copy link
Contributor Author

@mpint mpint Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about this @mvadari ? Took a quick look at this and it would dry things up nicely (11 impacted types for PaginationRequest and 12 for PaginationResponse). Happy to do it in another PR.

export interface PaginationRequest {
  /** Limit the number of results to retrieve. */
  limit?: number
  /** Value from a previous paginated response. Resume retrieving data where that response left off. */
  marker?: unknown
}

export interface PaginationResponse {
  marker?: unknown
  limit?: number
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I like that! Fine with it being in a separate PR

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (3)
MISSING_FIELDS--DONE.md (1)

1-244: Consider removing this planning document from the repository.

This file appears to be an implementation plan and PR template that was used during development. Such planning documents are typically kept in PR descriptions, issue trackers, or project wikis rather than committed to the repository. If this file serves a documentation purpose for the changes made, consider consolidating it into CHANGELOG entries or removing it before merge.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@MISSING_FIELDS--DONE.md` around lines 1 - 244, Remove the
MISSING_FIELDS--DONE.md planning document from the repository (or move its
contents into the PR description, issue tracker, project wiki, or a changelog
entry) so only the implementation code and generated OpenAPI/schema artifacts
remain committed; if you need to preserve the notes, create a concise CHANGELOG
entry or link the issue/PR instead, then commit the deletion and update the PR
to reflect the removal.
FUNDAMENTAL_TYPE_REFACTORING_PLAN.md (1)

1-1082: Consider whether this planning document should be in the repository.

This comprehensive 1000+ line refactoring plan documents a significant type system overhaul for ts-json-schema-generator compatibility. While valuable, this appears to be:

  1. Out of scope for this PR - The PR title indicates "missing fields" changes, not the fundamental type refactoring described here.
  2. Better suited for alternative locations - Such detailed architectural plans typically reside in:
    • GitHub Discussions or Issues
    • Project wiki
    • ADR (Architecture Decision Record) folder if the project uses them
    • Separate design document repository

If this is intentionally included to document future work, consider adding a clear note at the top indicating its purpose (e.g., "Future Work" or "Proposed RFC").

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@FUNDAMENTAL_TYPE_REFACTORING_PLAN.md` around lines 1 - 1082, The review flags
that the large "FUNDAMENTAL_TYPE_REFACTORING_PLAN.md" is out-of-scope for this
PR (which targets "missing fields"); remove or relocate the file from this PR
and instead publish it as a separate design artifact (e.g., GitHub Discussion,
Issue, ADR folder, or a dedicated RFC repository) or, if keeping in-tree for
visibility, add a clear top-level note indicating "Proposed RFC / Future Work —
not part of current PR" and convert it to a draft (so it won't be merged as part
of this change); ensure references to symbols like TransactionMetadata,
TxResponse, LedgerEntryResponse, SimulateRequest, and TransactionSchema remain
in the new location and update the PR to only include the intended "missing
fields" changes.
packages/xrpl/test/integration/requests/ammInfo.test.ts (1)

46-68: Consider asserting account-specific LP token information.

The test validates that the account parameter is accepted, but it doesn't verify the account-specific behavior. According to the XRP Ledger API, when an account is provided, the response should include the amount of that account's LP Tokens. Consider adding an assertion for the lp_token field specific to the provided account to strengthen the test.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/xrpl/test/integration/requests/ammInfo.test.ts` around lines 46 -
68, The test checks general AMM fields but misses validating account-specific LP
token info; after fetching amm from ammInfoRes.result, add an assertion that
amm.lp_token equals the expected LP token amount for lpWallet (use
lpWallet.classicAddress / any LP balance value set up in ammPool during test
setup to derive the expected string) — e.g., assert.equal(amm.lp_token,
'<expected_lp_token_value>') using the expected value from your ammPool setup so
the test verifies the account-specific LP token field is returned.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@FUNDAMENTAL_TYPE_REFACTORING_PLAN.md`:
- Around line 1-1082: The review flags that the large
"FUNDAMENTAL_TYPE_REFACTORING_PLAN.md" is out-of-scope for this PR (which
targets "missing fields"); remove or relocate the file from this PR and instead
publish it as a separate design artifact (e.g., GitHub Discussion, Issue, ADR
folder, or a dedicated RFC repository) or, if keeping in-tree for visibility,
add a clear top-level note indicating "Proposed RFC / Future Work — not part of
current PR" and convert it to a draft (so it won't be merged as part of this
change); ensure references to symbols like TransactionMetadata, TxResponse,
LedgerEntryResponse, SimulateRequest, and TransactionSchema remain in the new
location and update the PR to only include the intended "missing fields"
changes.

In `@MISSING_FIELDS--DONE.md`:
- Around line 1-244: Remove the MISSING_FIELDS--DONE.md planning document from
the repository (or move its contents into the PR description, issue tracker,
project wiki, or a changelog entry) so only the implementation code and
generated OpenAPI/schema artifacts remain committed; if you need to preserve the
notes, create a concise CHANGELOG entry or link the issue/PR instead, then
commit the deletion and update the PR to reflect the removal.

In `@packages/xrpl/test/integration/requests/ammInfo.test.ts`:
- Around line 46-68: The test checks general AMM fields but misses validating
account-specific LP token info; after fetching amm from ammInfoRes.result, add
an assertion that amm.lp_token equals the expected LP token amount for lpWallet
(use lpWallet.classicAddress / any LP balance value set up in ammPool during
test setup to derive the expected string) — e.g., assert.equal(amm.lp_token,
'<expected_lp_token_value>') using the expected value from your ammPool setup so
the test verifies the account-specific LP token field is returned.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 32e9dc3 and f08bd64.

📒 Files selected for processing (10)
  • FUNDAMENTAL_TYPE_REFACTORING_PLAN.md
  • MISSING_FIELDS--DONE.md
  • TYPE_SYSTEM_QUALITY.md
  • packages/xrpl/src/models/methods/accountLines.ts
  • packages/xrpl/src/models/methods/ammInfo.ts
  • packages/xrpl/src/models/methods/nftBuyOffers.ts
  • packages/xrpl/src/models/methods/nftSellOffers.ts
  • packages/xrpl/test/integration/requests/accountLines.test.ts
  • packages/xrpl/test/integration/requests/ammInfo.test.ts
  • packages/xrpl/test/integration/requests/vaultInfo.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/xrpl/src/models/methods/accountLines.ts
  • packages/xrpl/src/models/methods/nftSellOffers.ts
  • packages/xrpl/src/models/methods/nftBuyOffers.ts
  • packages/xrpl/src/models/methods/ammInfo.ts

@mpint
Copy link
Contributor Author

mpint commented Mar 2, 2026

Hi @ckeshava,

I've addressed the integration test request by updating existing integration test files to cover the newly added fields:

Updated existing integration tests:

  • accountLines.test.ts - Added tests for ignore_default request field and limit response field
  • ammInfo.test.ts - Added test for account field
  • vaultInfo.test.ts - Added test for ledger_current_index field

📝 Note on missing test coverage:

The following newly added fields don't have dedicated integration test files yet:

  • NFTBuyOffersRequest/Response - limit and marker fields (no nftBuyOffers.test.ts exists)
  • NFTSellOffersRequest/Response - limit and marker fields (no nftSellOffers.test.ts exists)
  • AccountNFTsResponse - ledger_hash, ledger_index, and validated fields (no accountNFTs.test.ts exists)

These NFT methods are currently only tested indirectly within transaction tests. Would you like me to create new integration test files for these methods in this PR, or should that be saved for another body of work to keep this PR focused on the type additions?

@mpint mpint requested a review from ckeshava March 2, 2026 23:44
@mpint mpint force-pushed the mpint/missing-fields branch from f08bd64 to ff6c5a5 Compare March 3, 2026 16:09
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
packages/xrpl/src/models/methods/nftBuyOffers.ts (1)

45-53: Add dedicated integration coverage for nft_buy_offers pagination fields.

These new response fields (limit, marker) should be covered by a method-specific integration test to prevent future drift in typed API contracts.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/xrpl/src/models/methods/nftBuyOffers.ts` around lines 45 - 53, Add
an integration test that verifies the nft_buy_offers pagination fields are
preserved and typed: call the nftBuyOffers method (or exported function handling
nft_buy_offers) against a test instance/fixture returning a response with limit
and marker, assert the returned NftBuyOffersResponse (or equivalent DTO) exposes
limit as a number and marker with the expected value/type, and update the
method's parsing/types if the test fails; focus assertions on the limit and
marker fields to prevent future contract drift.
packages/xrpl/src/models/methods/nftSellOffers.ts (1)

18-27: Add integration coverage for nft_sell_offers pagination fields.

limit and marker were added on Line 22 and Line 27, but this PR context indicates no dedicated nftSellOffers integration test exists yet. Please add request/response assertions for these fields to prevent type regressions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/xrpl/src/models/methods/nftSellOffers.ts` around lines 18 - 27, Add
an integration test for nftSellOffers that sends a request including both limit
and marker and asserts the client transmits those fields and correctly parses
them from the server response: create a test that calls the nftSellOffers method
(or the higher-level client wrapper that invokes it) with a specific limit and
marker, mock or capture the outgoing request to assert the request body/query
contains limit and marker, return a mock paginated response including marker and
any truncated/limited result set, and assert the parsed response object exposes
the same limit/marker values (and any types used for marker) so regressions in
request/response handling for the nftSellOffers pagination fields are caught.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/xrpl/src/models/methods/nftBuyOffers.ts`:
- Around line 45-53: Add an integration test that verifies the nft_buy_offers
pagination fields are preserved and typed: call the nftBuyOffers method (or
exported function handling nft_buy_offers) against a test instance/fixture
returning a response with limit and marker, assert the returned
NftBuyOffersResponse (or equivalent DTO) exposes limit as a number and marker
with the expected value/type, and update the method's parsing/types if the test
fails; focus assertions on the limit and marker fields to prevent future
contract drift.

In `@packages/xrpl/src/models/methods/nftSellOffers.ts`:
- Around line 18-27: Add an integration test for nftSellOffers that sends a
request including both limit and marker and asserts the client transmits those
fields and correctly parses them from the server response: create a test that
calls the nftSellOffers method (or the higher-level client wrapper that invokes
it) with a specific limit and marker, mock or capture the outgoing request to
assert the request body/query contains limit and marker, return a mock paginated
response including marker and any truncated/limited result set, and assert the
parsed response object exposes the same limit/marker values (and any types used
for marker) so regressions in request/response handling for the nftSellOffers
pagination fields are caught.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f08bd64 and ff6c5a5.

📒 Files selected for processing (7)
  • packages/xrpl/src/models/methods/accountLines.ts
  • packages/xrpl/src/models/methods/ammInfo.ts
  • packages/xrpl/src/models/methods/nftBuyOffers.ts
  • packages/xrpl/src/models/methods/nftSellOffers.ts
  • packages/xrpl/test/integration/requests/accountLines.test.ts
  • packages/xrpl/test/integration/requests/ammInfo.test.ts
  • packages/xrpl/test/integration/requests/vaultInfo.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/xrpl/src/models/methods/ammInfo.ts
  • packages/xrpl/test/integration/requests/vaultInfo.test.ts
  • packages/xrpl/test/integration/requests/accountLines.test.ts

@ckeshava
Copy link
Collaborator

ckeshava commented Mar 3, 2026

These NFT methods are currently only tested indirectly within transaction tests. Would you like me to create new integration test files for these methods in this PR, or should that be saved for another body of work to keep this PR focused on the type additions?

Please create a new integration test file for all the updated Request-models. That will help us detect any future errors in the responses from these Requests.
@mpint

- Add nftBuyOffers.test.ts for NFTBuyOffersRequest/Response
- Add nftSellOffers.test.ts for NFTSellOffersRequest/Response
- Add accountNFTs.test.ts for AccountNFTsRequest/Response

Tests cover newly added fields including limit, marker, ledger_hash,
ledger_index, and validated fields. All tests passing.

Addresses review comment: XRPLF#3217 (comment)
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (4)
packages/xrpl/test/integration/requests/accountNFTs.test.ts (1)

150-151: Redundant assertion.

Same pattern as the other test files—assert.isDefined is unnecessary inside the if block.

♻️ Proposed fix
       // If there are more results, marker should be present
       if (response.result.marker !== undefined) {
-        assert.isDefined(response.result.marker)
         // Test pagination with marker
         const nextRequest: AccountNFTsRequest = {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/xrpl/test/integration/requests/accountNFTs.test.ts` around lines 150
- 151, Remove the redundant assertion inside the conditional: since the if
(response.result.marker !== undefined) already guarantees presence, delete the
assert.isDefined(response.result.marker) line (referencing
response.result.marker and the surrounding if block in accountNFTs.test.ts) so
the test doesn't duplicate checks.
packages/xrpl/test/integration/requests/nftBuyOffers.test.ts (1)

120-121: Redundant assertion.

Same as in nftSellOffers.test.tsassert.isDefined is unnecessary inside the if (marker !== undefined) block.

♻️ Proposed fix
       // If there are more results, marker should be present
       if (response.result.marker !== undefined) {
-        assert.isDefined(response.result.marker)
         // Test pagination with marker
         const nextRequest: NFTBuyOffersRequest = {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/xrpl/test/integration/requests/nftBuyOffers.test.ts` around lines
120 - 121, The test contains a redundant assertion inside the conditional that
already checks marker: remove the unnecessary
assert.isDefined(response.result.marker) in nftBuyOffers.test.ts so the code
simply branches on if (response.result.marker !== undefined) { ... } without
re-asserting; locate the assertion referencing response.result.marker in the
nftBuyOffers.test.ts test and delete that assert to match the pattern used in
nftSellOffers.test.ts.
packages/xrpl/test/integration/requests/nftSellOffers.test.ts (2)

111-112: Redundant assertion.

assert.isDefined(response.result.marker) is unnecessary since it's already inside an if (response.result.marker !== undefined) block.

♻️ Proposed fix
       // If there are more results, marker should be present
       if (response.result.marker !== undefined) {
-        assert.isDefined(response.result.marker)
         // Test pagination with marker
         const nextRequest: NFTSellOffersRequest = {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/xrpl/test/integration/requests/nftSellOffers.test.ts` around lines
111 - 112, The test contains a redundant assertion: inside the if-check for
response.result.marker !== undefined you call
assert.isDefined(response.result.marker); remove that redundant assert (or
invert logic and replace the if with an assert if you intended a required
value). Update the test around response.result.marker (the conditional using
response.result.marker !== undefined and the call to assert.isDefined) so you
either remove the assert inside the if-block or refactor the if into an assert
that validates presence before using the marker.

9-12: Remove unused imports.

xrpToDrops and unixTimeToRippleTime are imported but will be unnecessary after fixing the NFTokenMint fields. The only remaining use of xrpToDrops would be in sellOfferTx after applying the fix (and in the "additional sell offer" test at line 134).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/xrpl/test/integration/requests/nftSellOffers.test.ts` around lines 9
- 12, Remove the unused imports xrpToDrops and unixTimeToRippleTime from the
import list in nftSellOffers.test.ts (they become unnecessary once the
NFTokenMint fields are fixed); update references so only required uses remain
(confirm sellOfferTx and the "additional sell offer" test still use xrpToDrops
if needed) and delete the two imports (xrpToDrops, unixTimeToRippleTime) from
the import block to eliminate unused-import warnings.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/xrpl/test/integration/requests/accountNFTs.test.ts`:
- Around line 150-151: Remove the redundant assertion inside the conditional:
since the if (response.result.marker !== undefined) already guarantees presence,
delete the assert.isDefined(response.result.marker) line (referencing
response.result.marker and the surrounding if block in accountNFTs.test.ts) so
the test doesn't duplicate checks.

In `@packages/xrpl/test/integration/requests/nftBuyOffers.test.ts`:
- Around line 120-121: The test contains a redundant assertion inside the
conditional that already checks marker: remove the unnecessary
assert.isDefined(response.result.marker) in nftBuyOffers.test.ts so the code
simply branches on if (response.result.marker !== undefined) { ... } without
re-asserting; locate the assertion referencing response.result.marker in the
nftBuyOffers.test.ts test and delete that assert to match the pattern used in
nftSellOffers.test.ts.

In `@packages/xrpl/test/integration/requests/nftSellOffers.test.ts`:
- Around line 111-112: The test contains a redundant assertion: inside the
if-check for response.result.marker !== undefined you call
assert.isDefined(response.result.marker); remove that redundant assert (or
invert logic and replace the if with an assert if you intended a required
value). Update the test around response.result.marker (the conditional using
response.result.marker !== undefined and the call to assert.isDefined) so you
either remove the assert inside the if-block or refactor the if into an assert
that validates presence before using the marker.
- Around line 9-12: Remove the unused imports xrpToDrops and
unixTimeToRippleTime from the import list in nftSellOffers.test.ts (they become
unnecessary once the NFTokenMint fields are fixed); update references so only
required uses remain (confirm sellOfferTx and the "additional sell offer" test
still use xrpToDrops if needed) and delete the two imports (xrpToDrops,
unixTimeToRippleTime) from the import block to eliminate unused-import warnings.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ff6c5a5 and 375afbf.

📒 Files selected for processing (3)
  • packages/xrpl/test/integration/requests/accountNFTs.test.ts
  • packages/xrpl/test/integration/requests/nftBuyOffers.test.ts
  • packages/xrpl/test/integration/requests/nftSellOffers.test.ts

…mports

- Remove redundant assert.isDefined calls in marker checks (already inside undefined checks)
- Remove unused unixTimeToRippleTime import from nftSellOffers.test.ts
- Remove invalid Amount and Expiration fields from NFTokenMint transaction
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/xrpl/test/integration/requests/nftBuyOffers.test.ts`:
- Around line 51-54: The test currently assigns nftokenID to getNFTokenID(...)
?? 'undefined', which hides failures; change this to fail fast by checking the
return of getNFTokenID (the call inside nftBuyOffers.test.ts that sets
nftokenID) and throw or assert immediately if it is undefined (e.g., throw new
Error or use the test framework's assertion) so the test stops with a clear
error instead of using the literal 'undefined' in later requests.
- Around line 108-130: The test currently sets NFTBuyOffersRequest with limit: 1
but may pass without exercising pagination because only one offer exists; update
the test so pagination is guaranteed by either (A) creating at least two buy
offers for nftokenID in the test setup before calling
testContext.client.request, or (B) changing the request/limit to request fewer
results than exist (e.g., keep limit: 1 and ensure >1 offers exist). Locate the
NFTBuyOffersRequest construction and ensure the setup that creates offers
creates multiple offers for nftokenID (or adjust the limit) so
response.result.marker is present and the pagination branch (the subsequent
request using marker) is actually executed and asserted.

In `@packages/xrpl/test/integration/requests/nftSellOffers.test.ts`:
- Around line 50-53: The test assigns nftokenID using getNFTokenID(...) but
falls back to the literal string 'undefined', which allows a malformed ID to
propagate; replace that fallback with an explicit failure: after calling
getNFTokenID with txResponse.result.meta (TransactionMetadata<NFTokenMint>),
check whether the result is undefined and if so throw or assert (fail the test)
with a clear message referencing getNFTokenID and nftokenID so the test stops
immediately instead of continuing with an invalid ID.
- Around line 96-117: The pagination branch may not run because only one sell
offer exists; update the "with marker field for pagination" test so it
deterministically exercises marker pagination by ensuring multiple offers exist
before calling NFTSellOffersRequest: create and submit at least two sell offers
for the same nftokenID in the test setup (using the same helper/fixture you use
elsewhere to create offers), then perform the request with limit: 1 and assert
response.result.marker is defined before using it to fetch the next page via
testContext.client.request.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 375afbf and 95ee041.

📒 Files selected for processing (3)
  • packages/xrpl/test/integration/requests/accountNFTs.test.ts
  • packages/xrpl/test/integration/requests/nftBuyOffers.test.ts
  • packages/xrpl/test/integration/requests/nftSellOffers.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/xrpl/test/integration/requests/accountNFTs.test.ts

ledger_index: 'validated',
}
const response = await testContext.client.request(request)
assert.equal(response.type, 'response')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check for the successful completion of the response

Comment on lines +87 to +91
// ledger_index should be present when using validated ledger
if (response.result.ledger_index !== undefined) {
assert.isNumber(response.result.ledger_index)
assert.isAtLeast(response.result.ledger_index, 1)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this assertion can be combined with the above test


assert.equal(response.type, 'response')
assert.equal(response.result.nft_id, nftokenID)
// The limit field should be present in the response
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test fails silently if the limit field is absent in the response.

assert.isNotNull(response.result.limit, 'limit value must be present in the reponse');

I feel this is better ^

mpint and others added 4 commits March 3, 2026 15:33
…ness

- Fix linter errors in testUtils.ts by removing unnecessary non-null assertions and avoiding variable shadowing
- Improve NFT test robustness by explicitly checking for NFTokenID extraction failures instead of masking them with ?? 'undefined'
- Remove planning documents as requested by CodeRabbit
- Add status assertion in accountLines test for successful completion
- Make limit field assertion non-conditional in nftBuyOffers test
- Combine ledger_hash and ledger_index tests in accountNFTs test
- nftBuyOffers: Create second buy offer to ensure marker pagination is exercised
- nftSellOffers: Add initial sell offer in setup as comment indicated
- nftSellOffers: Create second sell offer to ensure marker pagination is exercised
- Replace conditional pagination checks with assertions to fail if marker is missing

Addresses CodeRabbit comments about non-deterministic pagination tests
@mpint
Copy link
Contributor Author

mpint commented Mar 4, 2026

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 4, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/xrpl/test/integration/requests/accountLines.test.ts`:
- Around line 86-90: The test currently treats response.result.limit as
optional; make the assertion deterministic by asserting the field exists and has
the expected type/value before further checks: replace the if-check with
explicit assertions such as asserting response.result has property "limit" (or
assert.exists(response.result.limit)), then
assert.isNumber(response.result.limit) and
assert.isAtMost(response.result.limit, 10); update the assertions around the
variable response (from the accountLines test) so the test fails if the new
limit field is missing.

In `@packages/xrpl/test/integration/requests/accountNFTs.test.ts`:
- Around line 22-33: The pagination test is nondeterministic because only one
NFT is minted in beforeEach (mintTx) so the account_nfts response may not return
a marker; update the setup and test to force pagination deterministically by
creating enough NFTs (e.g., call testTransaction with NFTokenMint multiple times
in beforeEach or within the test) or by setting the request Limit to 1 so a
marker is guaranteed; then remove the conditional skip and assert on the
returned marker handling logic in the accountNFTs test (reference NFTokenMint
mintTx, testTransaction, and the response.marker assertion) so the marker path
is always exercised.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0aeab92f-97b3-4556-8f56-765f4abbf87f

📥 Commits

Reviewing files that changed from the base of the PR and between 95ee041 and f90c8c9.

📒 Files selected for processing (5)
  • packages/xrpl/test/integration/requests/accountLines.test.ts
  • packages/xrpl/test/integration/requests/accountNFTs.test.ts
  • packages/xrpl/test/integration/requests/nftBuyOffers.test.ts
  • packages/xrpl/test/integration/requests/nftSellOffers.test.ts
  • packages/xrpl/test/testUtils.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/xrpl/test/integration/requests/nftSellOffers.test.ts

@mpint
Copy link
Contributor Author

mpint commented Mar 5, 2026

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@FUNDAMENTAL_TYPE_REFACTORING_PLAN.md`:
- Around line 299-323: The TransactionSchema index-signature weakens public
typings; make it an internal-only schema type (e.g., rename to
InternalTransactionSchema) and stop using it as the public model. Keep the full
public union Transaction and TransactionBase for external exports, remove or
restrict the `[key: string]: unknown` from any type exported for consumers, and
where runtime-flexible schema is required (for schema generation or validation)
use the new InternalTransactionSchema and only export it from an internal
module; reference TransactionSchema, TransactionBase, Transaction, and
BaseTransaction to locate and change the exported types, and mirror the
xrpl.js/MPTokenMetadata approach by providing long-form explicit public
interfaces while keeping a separate flexible schema for runtime use.
- Around line 1-18: The roadmap in FUNDAMENTAL_TYPE_REFACTORING_PLAN.md proposes
repo-wide breaking refactors (affecting symbols/methods ledger, ledger_entry,
submit_multisigned, tx, simulate and referencing ranges 946-1082) and must be
removed from PR `#3217` and moved into a separate RFC/tracking issue; update the
PR to only include the targeted missing-fields/types fix by extracting or
deleting this document from the branch, create a new issue or RFC that contains
the full plan (linking the new issue from the PR), and ensure any references to
the plan (e.g., PR `#3217`, the listed methods) are replaced with a pointer to the
new tracking issue so the narrow fix PR remains non-breaking and focused.
- Around line 163-172: Document reproducible evidence before asserting
ts-json-schema-generator limitations: run the tool against the specific
conditional types discussed, capture and paste exact error outputs (e.g.,
"Error: Encountered a reference to a missing definition"), record the tested
ts-json-schema-generator and TypeScript versions, include the exact type
definitions that trigger failures and a minimal repro (commands/tsconfig) with
steps to reproduce, and reference these findings in the sections that claim the
generator “cannot evaluate conditional types” and the “Flatten to Union Types”
refactor rationale so the breaking-change decision is empirically justified.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 160ca7ad-7c74-41ca-87ae-adfe7c36ce98

📥 Commits

Reviewing files that changed from the base of the PR and between f90c8c9 and 32f7bec.

📒 Files selected for processing (3)
  • FUNDAMENTAL_TYPE_REFACTORING_PLAN.md
  • packages/xrpl/test/integration/requests/accountLines.test.ts
  • packages/xrpl/test/integration/requests/accountNFTs.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/xrpl/test/integration/requests/accountLines.test.ts
  • packages/xrpl/test/integration/requests/accountNFTs.test.ts

- accountLines: Make limit assertion non-conditional
- accountNFTs: Mint two NFTs to ensure pagination is exercised
- accountNFTs: Replace conditional marker check with assertion

Addresses CodeRabbit comments about non-deterministic pagination tests
@mpint mpint force-pushed the mpint/missing-fields branch from 32f7bec to 6dd0338 Compare March 5, 2026 17:17
@mpint
Copy link
Contributor Author

mpint commented Mar 5, 2026

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@mpint mpint requested a review from ckeshava March 5, 2026 17:24
}
const response = await testContext.client.request(request)

assert.equal(response.type, 'response')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert.equal(response.type, 'response')
assert.equal(response.result.status, 'success')

}
const response = await testContext.client.request(request)

assert.equal(response.type, 'response')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert.equal(response.type, 'response')
assert.equal(response.result.status, 'success')

const response = await testContext.client.request(request)

assert.equal(response.type, 'response')
assert.equal(response.result.account, testContext.wallet.address)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert.equal(response.result.account, testContext.wallet.address)
assert.equal(response.result.status, 'success')

marker: response.result.marker,
}
const nextResponse = await testContext.client.request(nextRequest)
assert.equal(nextResponse.type, 'response')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert.equal(nextResponse.type, 'response')
assert.equal(nextResponse.result.status, 'success')

}
const nextResponse = await testContext.client.request(nextRequest)
assert.equal(nextResponse.type, 'response')
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also assert that nextResponse does not have a marker field because it has reached the end of the results list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants